<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
<script type="text/html" id="toolbar"></script>
{include file="system@block/layui" /}
<script type="text/javascript">
    layui.use(['table','jquery','form', 'formSelects'], function() {
        var table = layui.table,$=layui.jquery,form = layui.form;var formSelects = layui.formSelects;
        table.render({
            elem: '#dataTable'
            ,url: '{:url()}'+'?types={$types}'+ "&factory_id={$thisFactoryId}&from={$thisFrom}"  //数据接口
            ,page: true //开启分页
            ,skin: 'row'
            ,even: true
            ,limit: 20
            ,limits: [20,50,100,150,200,10000]
            ,text: {
                none : '暂无相关数据'
            }
            ,toolbar: '#toolbar'
            ,defaultToolbar: ['filter', 'exports', 'print']
            ,cols: [[ //表头
                // {type:'checkbox', fixed:'left'}
                // ,{field: 'id', title: '编号', sort: true}
                {field: 'client_ordernum', title: '订单号'}
                {if $types =='jit'}
                ,{field: 'delivery_number', title: '发货单号'}
                {/if}
                ,{field: 'ft_name', title: '所属工厂'}
                ,{field: 'sum_count', title: '数量'}
                ,{field: 'status_txt', title: '状态'}
                ,{field: 'create_time', title: '下单时间'}
            ]]
            ,done(res){
                var data=res.data;
                for (var i in data){
                    $('#factory-ids-'+data[i]['id']).val(data[i]['factory_id']);
                }
                layui.form.render();
            }
        });

        //头工具栏事件
        // table.on('toolbar(dataTable)', function(obj){
        //     switch(obj.event){
        //         case 'MIMO_EXPORT':
        //             table.exportFile(ins1.config.id, orderList, 'xls');
        //             break;
        //     };
        // });
    });
</script>